﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using System.Text.RegularExpressions;
using SMS.Properties;

namespace SMS
{
    public partial class frmSettings : Form
    {
        public frmSettings()
        {
            InitializeComponent();
        }

        

        private void Settings_Load(object sender, EventArgs e)
        {


        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            // Save Settings 
            Settings.Default.Save();

            // Set Program Connections
            ClosingSettings();
        }

        private void ClosingSettings()
        {
            frmMain owner = (frmMain)this.Owner;
            owner._gateway = new SMS_Gateway.SMSMisrGateway(txtSenderID.Text);
            owner._cred = new SMS_Gateway.Credentials(txtName.Text, txtPassword.Text);
                // Make it in the settings 
                //new SMS_Gateway.SMSGobalGateway(txtSenderID.Text);
            //owner._gateway.Login(txtName.Text, txtPassword.Text);
            //if (!owner._gateway.IsConnected)
            //{
            //    owner._gateway = null;
            //}
        }

        private void frmSettings_FormClosing(object sender, FormClosingEventArgs e)
        {
       //     ClosingSettings();
        }


    }
}
